#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


from feign_client.eureka_init import eureka_init

from common.utils.log_utils import logger
from platform_auth.settings import EUREKA_SERVER, EUREKA_CLIENT_APP_NAME, EUREKA_CLIENT_PORT, IS_EUREKA


def main():
    if IS_EUREKA:
        eureka_init(eureka_server = EUREKA_SERVER, app_name = EUREKA_CLIENT_APP_NAME, port = EUREKA_CLIENT_PORT)

    """Run administrative tasks."""
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'platform_auth.settings')
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    execute_from_command_line(sys.argv)


if __name__ == '__main__':
    main()
